<template>
    <div>
        <navtitle title="商品列表" />
        <div v-for="item in searchApiData">
            <router-link :to="{ name: 'goods', params: { goods_id: item.goods_id } }">
                <van-card :price="item.goods_price" :title="item.goods_name"
                    :thumb="item.goods_big_logo ? item.goods_big_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
            </router-link>

        </div>

    </div>
</template>

<script setup>
import navtitle from '@/components/navtitle.vue';
import { searchApi } from '@/api/api'
import { useRoute, useRouter } from 'vue-router'

const route = useRoute()
import { ref } from 'vue'
const searchApiData = ref([])
searchApi(route.params.query).then(res => {
    console.log('商品列表', res);
    searchApiData.value = res.data.message.goods
})

</script>

<style lang="scss" scoped></style>